<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ page import="dou.servletShopp.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'productList.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
	<%
		List<Product> products = (List<Product>) request.getAttribute("products");
		for (int i = 0; i < products.size(); i++) {
			Product p = products.get(i);
	%>
<tr> 
<td class="altbg2">&nbsp;&nbsp;<%=p.getModel()%></td>
<td class="altbg2"><img src="shopp/img/<%=p.getPic()%>" width="150" height="90" /></td>
<td class="altbg2"><%=p.getProdDesc()%></td>
<td class="altbg2">￥<%=p.getPrice()%></td>
<td class="altbg2">
<%
	String msg = (String) request.getAttribute("buy_msg_" + p.getId());
%>
<a href="/servletTest/shopp/buy.do?id=<%=p.getId()%>">购买</a>
<span style="color:red;"><%=(msg == null ? "" : msg)%></span></td></tr>
<%
	}
%>
<center>
<input class="button" type="button" value="查看购物车" name="settingsubmit" onclick="location = 'shopp/cart.jsp';">
</center>

  </body>
</html>
